exports.__esModule = true;

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

exports.default = class extends think.BaseController {
  /**
   * 查询客户信息
   *
   * @returns
   */
  doGetCustomerListForPageAction() {
    var _this = this;

    return _asyncToGenerator(function* () {
      const CallCustomerService = yield _this.service("call/CallCustomerService");
      let getData = _this.get("page,pageSize,real_name,phone");
      const Res = yield CallCustomerService.doGetCustomerListForPage(getData);
      if (Res.error) {
        return _this.errorJson("操作失败");
      } else {
        return _this.successJson(Res);
      }
    })();
  }

  /**
   * 通过id 查询客户信息
   *
   * @returns
   */
  doGetCustomerListByIdAction() {
    var _this2 = this;

    return _asyncToGenerator(function* () {
      const CallCustomerService = yield _this2.service("call/CallCustomerService");
      let getData = {
        id: _this2.get("id")
      };
      const Res = yield CallCustomerService.doGetCustomerListById(getData);
      if (Res && Res.error) {
        return _this2.errorJson("操作失败");
      } else {
        return _this2.successJson(Res);
      }
    })();
  }

  /**
   * 通过电话号码 查询客户信息
   *
   * @returns
   */
  doGetCustomerListByPhoneAction() {
    var _this3 = this;

    return _asyncToGenerator(function* () {
      const CallCustomerService = yield _this3.service("call/CallCustomerService");
      let getData = {
        phone: _this3.get("phone")
      };
      const Res = yield CallCustomerService.doGetCustomerListByPhone(getData);
      if (Res && Res.error) {
        return _this3.errorJson("操作失败");
      } else {
        return _this3.successJson(Res);
      }
    })();
  }
  doDeleteCustomerByIdAction() {
    var _this4 = this;

    return _asyncToGenerator(function* () {
      const CallCustomerService = yield _this4.service("call/CallCustomerService");
      let postData = {
        id: _this4.post("id")
      };
      const Res = yield CallCustomerService.doDelCustomerById(postData);
      if (Res && Res.error) {
        return _this4.errorJson("操作失败");
      } else {
        return _this4.successJson(Res);
      }
    })();
  }
};